<?php
//php console head
require_once('C:\wamp\www\test\PhpConsole\PhpConsole.php');
PhpConsole::start();
// test
debug('php console debug enbled');

//Connect to database
$username = "admin";
$password = "admin";
$database = "staff_db";
$server = "localhost";

$con_staff=mysql_connect($server,$username,$password)or die("Connection Error: ".mysql_error());

mysql_select_db($database) or die("Error connecting to db.");

//Read data from post
//writeToFile($_POST["PersonID"]);
//writeToFile($_POST["FirstName"]);
//writeToFile($_POST["LastName"]);
//writeToFile($_POST["Age"]);

$id = $_POST["PersonID"];
$fn = $_POST["FirstName"];
$ln = $_POST["LastName"];
$age = $_POST["Age"];


//Update in database

$SQL="UPDATE persons SET FirstName='$fn', LastName='$ln', Age='$age'  WHERE PersonID='$id'";

//$SQL="UPDATE persons SET FirstName='wwww', LastName='yyyyy', Age='33333'  WHERE PersonID='3'";

$result =mysql_query($SQL) or die("Counld not execute query.".mysql_error());

?>